//合同状态
const contract_status = {
  1: "#078d5c", //已签订
  2: "#ed7b2f", //未签订
  3: "#1D7FF2", //执行
  4: "#cccccc", //暂停
  5: "#ed7b2f", //解除
  6: "#078d5c", //关闭
};

//合同管理-审批状态
const work_flow_status = {
  NOT_SUBMITTED: "#ed7b2f", //待提交
  UNDER_REVIEW: "#1D7FF2", //审核中
  APPROVED: "#078d5c", //审批通过
  REVIEW_REJECTION: "#FF3B30", //拒绝
};

//征拆迁状态
const demolition_status = {
  1: "#CCCCCC", //未开始
  2: "#1D7FF2", //建设中
  3: "#ed7b2f", //终止
  4: "#078d5c", //已完工
};

//节点状态
const node_status = {
  施工中: "#1D7FF2",
  验收: "#078D5C",
  移交: "#ED7B2F",
  未验收: "#CCCCCC",
};

//项目查询节点状态
const search_node_status = {
  未开始: "#CCCCCC",
  进行中: "#1D7FF2",
  已完成: "#078d5c",
};

const first_node_status = {
  未施工: "#CCCCCC",
  施工中: "#1D7FF2",
  完工: "#078D5C",
  未验收: "#CCCCCC",
  已验收: "#078D5C",
  未移交: "#CCCCCC",
  已移交: "#078D5C",
  验收中: "#1D7FF2",
  移交中: "#ed7b2f",
  无需办理: "#ed7b2f",
  未启动: "#CCCCCC",
  进行中: "#1D7FF2",
  已办理: "#078D5C",
};

const monitor_equipment_status = {
  2: "#CCCCCC",
  1: "#1D7FF2",
};

//推进状态
const report_status = {
  1: "#078d5c",
  2: "#C41C24", //滞后
  3: "#1d7ff2",
};

//规划管理-状态
const status = {
  UN_SUBMITTED: "#1D7FF2", //草稿
  SUBMITTED: "#078d5c", //已提交
};

function getColorObj(type) {
  switch (type) {
    case "1":
      return contract_status;
    case "2":
      return work_flow_status;
    case "3":
      return demolition_status;
    case "4":
      return node_status;
    case "5":
      return search_node_status;
    case "6":
      return first_node_status;
    case "7":
      return monitor_equipment_status;
    case "8":
      return report_status;
    case "9":
      return status;
    default:
      return {};
  }
}

//样式
function getColor(type, row, key) {
  const obj = getColorObj(type);
  return {
    marginRight: "8px",
    display: "inline-block",
    width: "8px",
    height: "8px",
    borderRadius: "4px",
    backgroundColor: obj[row[key]],
  };
}

module.exports = {
  getColor,
};
